package com.expert.miniapp.dto;

import lombok.Data;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

import java.util.List;
import java.util.Map;

/**
 * AIMatchRequest - AI API璇锋眰缁撴瀯
 *
 * 鍙戦€佺粰AI API鐨勮姹備綋缁撴瀯
 *
 * @author System
 * @since 2025-10-31
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AIMatchRequest {

    /**
     * AI妯″瀷鍚嶇О
     * 榛樿: gpt-3.5-turbo
     */
    private String model;

    /**
     * 娑堟伅鍒楄〃
     */
    private List<Message> messages;

    /**
     * Dify骞冲彴鐗瑰畾鍙傛暟
     * 鍖呭惈resource_id鍜寀ser_request绛変笂涓嬫枃淇℃伅
     */
    private Map<String, String> inputs;

    /**
     * 生成温度参数，取值范围0-2
     */
    private Double temperature;

    /**
     * 是否使用流式输出
     * true: 使用Server-Sent Events(SSE)流式返回
     * false: 一次性返回完整响应
     */
    private Boolean stream;

    /**
     * Message鍐呴儴绫?- 琛ㄧず鍗曟潯娑堟伅
     */
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class Message {

        /**
         * 瑙掕壊锛歶ser锛堢敤鎴凤級鎴?assistant锛堝姪鎵嬶級
         */
        private String role;

        /**
         * 娑堟伅鍐呭锛圖emand瀵硅薄鐨凧SON瀛楃涓诧級
         */
        private String content;
    }

    /**
     * 渚挎嵎鏋勯€犳柟娉?- 鍒涘缓鐢ㄦ埛娑堟伅璇锋眰
     *
     * @param model   妯″瀷鍚嶇О
     * @param content 鐢ㄦ埛娑堟伅鍐呭
     */
    public AIMatchRequest(String model, String content) {
        this.model = model;
        this.messages = List.of(new Message("user", content));
    }
}


